package com.xinyan.controller;

import com.xinyan.pojo.SprayAdItem;
import com.xinyan.service.ISprayAdItemService;
import com.xinyan.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xzlf
 * @since 2024-03-19 17:57:43
 */
@RestController
@RequestMapping("/ad")
public class SprayAdItemController {

    @Autowired
    private ISprayAdItemService sprayAdItemService;

    @GetMapping("/aditem")
    public R<List<SprayAdItem>> adItem(){
        return R.ok(sprayAdItemService.findAdItemList());
    }


    @PostMapping("/addAdItem")
    public R addAdItem(@RequestBody SprayAdItem sprayAdItem){
        sprayAdItemService.addAdItem(sprayAdItem);
        return R.ok();
    }

    @GetMapping("/deleteAdItem")
    public R deleteAdItem(int id){
        sprayAdItemService.deleteAdItem(id);
        return R.ok();
    }
}
